<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Logger Base Class - Logger Block</title><link rel="stylesheet" type="text/css" href="../../styles/main.css"><script language=JavaScript src="../../javascript/main.js"></script><script language=JavaScript src="../../javascript/prettify.js"></script></head><body class="FramedContentPage" onLoad="NDOnLoad();prettyPrint();"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>

<!--  Generated by Natural Docs, version 1.52 -->
<!--  http://www.naturaldocs.org  -->

<!-- saved from url=(0026)http://www.naturaldocs.org -->




<div id=Content><div class="CSection"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="Logger_Base_Class"></a>Logger Base Class</h1><div class=CBody><p>This Section describe Logger Base Class and its Method used for Logger Block.</p><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#Logger_Base_Class" >Logger Base Class</a></td><td class=SDescription>This Section describe Logger Base Class and its Method used for Logger Block.</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#Class_Constructor" >Class Constructor</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#new" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">new</a></td><td class=SDescription>Create the initializes an instance of this class using normal constructor arguments for &lt;uvm_component&gt; :</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#Phasing" >Phasing</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#build_phase" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">build_phase</a></td><td class=SDescription>The &lt;uvm_build_phase&gt; phase implementation method.</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#Base_Class_Library" >Base Class Library</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#init" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')">init</a></td><td class=SDescription>This function initialize the logger block. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#wait_for_state" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')">wait_for_state</a></td><td class=SDescription>This task waits for particular state which is set from C testcase.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#get_data_with_state" id=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')">get_data_with_state</a></td><td class=SDescription>This task wait for perticular state with user data at the output &lt;ret_data&gt;. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#release_state" id=link6 onMouseOver="ShowTip(event, 'tt6', 'link6')" onMouseOut="HideTip('tt6')">release_state</a></td><td class=SDescription>This task is used to release the C executaion which is hold by user with LOGGER_HOLD_STATE() Macro in C world.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#readcheck" id=link7 onMouseOver="ShowTip(event, 'tt7', 'link7')" onMouseOut="HideTip('tt7')">readcheck</a></td><td class=SDescription>This task is used to read and check the read value with expected value and print information in SV world if read value and expected value are same else throw &lt;UVM_ERROR&gt; in SV world.</td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="Class_Constructor"></a>Class Constructor</h3></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="new"></a>new</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>function new (</td><td class="PType  prettyprint " nowrap>string&nbsp;</td><td class="PParameter  prettyprint " nowrap>name,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>uvm_component&nbsp;</td><td class="PParameter  prettyprint " nowrap>parent</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Create the initializes an instance of this class using normal constructor arguments for &lt;uvm_component&gt; :</p><p>~name~   is the name of the instance</p><p>~parent~ is handle of the hierarchical parent, if any.</p></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="Phasing"></a>Phasing</h3></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="build_phase"></a>build_phase</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>function void build_phase(</td><td class="PType  prettyprint " nowrap>uvm_phase&nbsp;</td><td class="PParameter  prettyprint " nowrap>phase</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>The &lt;uvm_build_phase&gt; phase implementation method.</p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>MEM_BD</td><td class=CDLDescription>String name for config DB method which get object of Derived class</td></tr><tr><td class=CDLEntry>LOGGER_IF</td><td class=CDLDescription>String name for config DB method which get virtual interface handle.</td></tr></table></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="Base_Class_Library"></a>Base Class Library</h3></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="init"></a>init</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>function init(</td><td class="PTypePrefix  prettyprint " nowrap>bit&nbsp;</td><td class="PType  prettyprint " nowrap>[(`ADDRESS_WIDTH -1):0]&nbsp;</td><td class="PParameter  prettyprint " nowrap>saddr</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>This function initialize the logger block.&nbsp; User need to pass the address &lt;saddr&gt; of Default Memory location which would be shared by C code and SV code.</p><p><b>`ADDRESS_WIDTH</b> is by default 32, can be change by passing <u>+define+ADDRESS WIDTH=&lt;width&gt;</u> during compilation.</p><p><b>Arguments :</b></p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>saddr</td><td class=CDLDescription>Shared Memory address location for logger.</td></tr></table></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="wait_for_state"></a>wait_for_state</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>task automatic wait_for_state(</td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>s</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>This task waits for particular state which is set from C testcase.</p><p><b>Arguments :</b></p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>id</td><td class=CDLDescription>ID which is passed during C macro</td></tr></table><blockquote><pre>C Code -

UPDATE_LOGGER_BIT(1)

sv Code -

logger_inst.wait_for_state(1)
&lt;print your message here.&gt;</pre></blockquote><p>See more details in <u>example</u></p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="get_data_with_state"></a>get_data_with_state</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>task automatic get_data_with_state(</td><td class="PTypePrefix  prettyprint " nowrap>input&nbsp;</td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>s,</td></tr><tr><td></td><td class="PTypePrefix  prettyprint " nowrap>output&nbsp;</td><td class="PType  prettyprint " nowrap>bit[(`DATA_WIDTH-1):0]&nbsp;</td><td class="PParameter  prettyprint " nowrap>ret_data[]</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>This task wait for perticular state with user data at the output &lt;ret_data&gt;.&nbsp; It is used to passed the user data with information from C world to SV world.</p><p><b>Arguments :</b></p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>id</td><td class=CDLDescription>ID which is passed during C macro</td></tr><tr><td class=CDLEntry>ret_data</td><td class=CDLDescription>Its a dynamic array which contains userdata which passed from C world macro UPDATE_LOGGER_DATA(id,....)</td></tr></table><blockquote><pre>C World -
      int data1,data2;
      .
      .
      UPDATE_LOGGER_DATA(1,data1,data2);

SV world -

    bit[(`DATA_WIDTH-1):0] data[];
      .
      .
    logger_inst.get_data_with_state(1,data);
    &lt;print data[0] and data[1] here.&gt;</pre></blockquote><p>data[0] &lt;- data1</p><p>data[1] &lt;- data2</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="release_state"></a>release_state</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">task automatic release_state()</td></tr></table></blockquote><p>This task is used to release the C executaion which is hold by user with LOGGER_HOLD_STATE() Macro in C world.</p><blockquote><pre>C world -
       .
       .
       LOGGER_HOLD_STATE();
       statement0;

SV World :
       .
       .
       logger_inst.release_state()</pre></blockquote><p>after calling LOGGER_HOLD_STATE() macro in C world, C execution will be put on hold untill release_state() from SV world will call.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="readcheck"></a>readcheck</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">task automatic readcheck()</td></tr></table></blockquote><p>This task is used to read and check the read value with expected value and print information in SV world if read value and expected value are same else throw &lt;UVM_ERROR&gt; in SV world.</p><blockquote><pre>C world -
        .
        .
        READCHECK(Base_Address, Offset_address, Expected data); //1st call &lt;--|
        READCHECK(Base_Address, Offset_address, Expected data); //2nd call  &lt;-|---|
        .                                                                     |   |
        .                                                                     |   |
                                                                              |   |
SV world -                                                                    |   |
        .                                                                     |   |
        .                                                                     |   |
        logger_inst.readcheck(); //1st call ----------------------------------|   |
        logger_inst.readcheck(); //2nd call --------------------------------------|
        .
        .</pre></blockquote><p>For each <a href="logger-h.html#READCHECK" class=LMacro id=link8 onMouseOver="ShowTip(event, 'tt8', 'link8')" onMouseOut="HideTip('tt8')">READCHECK</a> macro call in C world needs <a href="#readcheck" class=LFunction id=link9 onMouseOver="ShowTip(event, 'tt7', 'link9')" onMouseOut="HideTip('tt7')">readcheck</a> method to be called.</p></div></div></div>

</div><!--Content-->



<!--START_ND_TOOLTIPS-->
<div class=CToolTip id="tt1"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>function new (</td><td class="PType  prettyprint " nowrap>string&nbsp;</td><td class="PParameter  prettyprint " nowrap>name,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>uvm_component&nbsp;</td><td class="PParameter  prettyprint " nowrap>parent</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Create the initializes an instance of this class using normal constructor arguments for uvm_component :</div></div><div class=CToolTip id="tt2"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>function void build_phase(</td><td class="PType  prettyprint " nowrap>uvm_phase&nbsp;</td><td class="PParameter  prettyprint " nowrap>phase</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>The uvm_build_phase phase implementation method.</div></div><div class=CToolTip id="tt3"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>function init(</td><td class="PTypePrefix  prettyprint " nowrap>bit&nbsp;</td><td class="PType  prettyprint " nowrap>[(`ADDRESS_WIDTH -1):0]&nbsp;</td><td class="PParameter  prettyprint " nowrap>saddr</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>This function initialize the logger block. </div></div><div class=CToolTip id="tt4"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>task automatic wait_for_state(</td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>s</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>This task waits for particular state which is set from C testcase.</div></div><div class=CToolTip id="tt5"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>task automatic get_data_with_state(</td><td class="PTypePrefix  prettyprint " nowrap>input&nbsp;</td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>s,</td></tr><tr><td></td><td class="PTypePrefix  prettyprint " nowrap>output&nbsp;</td><td class="PType  prettyprint " nowrap>bit[(`DATA_WIDTH-1):0]&nbsp;</td><td class="PParameter  prettyprint " nowrap>ret_data[]</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>This task wait for perticular state with user data at the output ret_data. </div></div><div class=CToolTip id="tt6"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">task automatic release_state()</td></tr></table></blockquote>This task is used to release the C executaion which is hold by user with LOGGER_HOLD_STATE() Macro in C world.</div></div><div class=CToolTip id="tt7"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">task automatic readcheck()</td></tr></table></blockquote>This task is used to read and check the read value with expected value and print information in SV world if read value and expected value are same else throw UVM_ERROR in SV world.</div></div><div class=CToolTip id="tt8"><div class=CMacro>This macro can be used to check the expected data from specific address. </div></div><!--END_ND_TOOLTIPS-->

<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>